import React from 'react'
import './index.css'
import axios from 'axios'
const arr = new Array(10).join(',').split(',')
class List extends React.Component{
    vote(mark) {
        // 给某个饮料评分
        // 发一个异步请求
        axios.post('/api/vote', {
            id: this.props.location.state.id,
            mark
        }).then(res => {

        })
    }
    render() {
        return <div>
            <div>您在多大程度上愿意向您的亲朋好友推荐？</div>
            <div className="vote">
                {
                    arr.map((item, i) => {
                        return <span key={i} onClick={() => this.vote(i)}>{i}</span>
                    })
                }
            </div>
        </div>
    }
}

export default List